 {include file="public/header" /}
  <body>
    <div class="x-body">
        <form  class="layui-form">
          <div class="layui-form-item">
              <label for="drawing_Internal_id" class="layui-form-label">内部编号</label>
              <div class="layui-input-inline">
                  <input type="text" id="drawing_Internal_id" name="drawing_Internal_id" disabled lay-verify="required"  autocomplete="off" class="layui-input" value="{$internal.drawing_Internal_id}">
                <input type="hidden" name="id" value="{$internal.id}">
                  <p id="pLog" style="color:red"></p>
              </div>
          </div>
            {if $internal.is_assembly_code == null}
            <div class="layui-form-item">
                <label class="layui-form-label">所属组件</label>
                <div class="layui-input-block">
                    <select name="assembly_code" >
                        <option value="">空</option>
                        {volist name="assemblyInfo" id = "info"}
                        <option value="{$info.assembly_code}"
                            {if $info.assembly_code ==$internal.assembly_code }
                                selected
                                {/if}
                        >{$info.assembly_code}</option>
                        {/volist}
                    </select>
                    <br>
                    <span style="color:red;">选择空代表移除</span>
                </div>
            </div>
            {/if}
            {if $internal.is_assembly_code == 1}
            <div class="layui-form-item">
                <label for="remark" class="layui-form-label">所属组件</label>
                <div class="layui-input-inline">
                    <input type="text"  autocomplete="off" class="layui-input" disabled value="{$internal.assembly_code}">
                </div>
            </div>
            {/if}
          <div class="layui-form-item">
              <label for="remark" class="layui-form-label">备注</label>
              <div class="layui-input-inline">
                  <input type="text" id="remark" name="remark" autocomplete="off" class="layui-input" value="{$internal.remark}">
              </div>
          </div>

          <div class="layui-form-item">
              <label class="layui-form-label"></label>
              <button class="layui-btn" lay-submit lay-filter="addId" >
                  修改
              </button>
          </div>
      </form>
    </div>
    <script>
        layui.use(['form'], function(){
          $ = layui.jquery;
          var form = layui.form,layer = layui.layer;

          //监听提交
          form.on('submit(addId)', function(data){
            //console.log(data);
              $.post("{:url('index/Internal/edit')}",data.field,function(info){
                  if (info) {
                      layer.alert("修改成功", {icon: 6},function () {
                          window.parent.location.reload();  //刷新父级页面
                          // 获得frame索引
                          var index = parent.layer.getFrameIndex(window.name);
                          //关闭当前弹出层
                          parent.layer.close(index);
                      });
                  }else{
                      layer.alert("修改失败", {icon: 5});
                  }
              },'json');
              return false;
          });
        });
    </script>

  </body>

</html>